package BVRClient;

/**
 * The Blue vs Red: Arena Camera Class.
 * @author Pandepic
 * @author Shannon Setter
 */
public class BVRC_Camera
{
	public enum CAMERA_MODE
	{
		CENTERED, SPECTATOR
	}
	
	private BVRC_Rect visibleRect = new BVRC_Rect(0, 0, 0, 0);
	private CAMERA_MODE currentMode = CAMERA_MODE.CENTERED;
	
	/**
	 * 
	 * @param player
	 */
	public void update(BVRC_Player player)
	{
		try
		{
			visibleRect.x = player.getEntityRect().x + (player.getEntityRect().width / 2) - (visibleRect.width / 2);
			visibleRect.y = player.getEntityRect().y + (player.getEntityRect().height / 2) - (visibleRect.height / 2);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
	
	/**
	 * 
	 * @param x
	 * @param y
	 */
	public void offset(float x, float y)
	{
		this.visibleRect.x += x;
		this.visibleRect.y += y;
	}
	
	/**
	 * 
	 * @param visibleRect
	 */
	public void setVisibleRect(BVRC_Rect visibleRect)
	{
		this.visibleRect = visibleRect;
	}
	
	/**
	 * 
	 * @return a rectangle describing the visible area of the camera
	 */
	public BVRC_Rect getVisibleRect()
	{
		return this.visibleRect;
	}
	
	/**
	 * 
	 * @param currentMode
	 */
	public void setCurrentMode(CAMERA_MODE currentMode)
	{
		this.currentMode = currentMode;
	}
	
	/**
	 * 
	 * @return the current camera mode
	 */
	public CAMERA_MODE getCurrentMode()
	{
		return this.currentMode;
	}
}
